#ifndef EVENTSERVER_H
#define EVENTSERVER_H

#include "singleton.h"
#include "var.h"

#include <cstdio>
#include <string>

namespace sde {


    class EventServer : public Singleton<EventServer> {
    public:
        typedef boost::function<void(VarMap)> SubscribeFunction;
        typedef std::list<SubscribeFunction> SubscribeFunctionList;
        typedef std::map<std::string, SubscribeFunctionList> SubscriberMap;
        
        SubscriberMap subscribers;
        
        void subscribe(std::string cmd, SubscribeFunction function);
        void unsubscribe(std::string cmd, SubscribeFunction function);
        void publish(std::string cmd, VarMap args);
    };

}

#endif
